<template>
	<view class="main">
		<u-search bgColor="#fff" :showAction="false" placeholder="输入昵称搜索" v-model="merge_keyword" @change="change"></u-search>
	<!-- 	<view class="tabs flex align between">
			<view class="flex align tab-item" @click="toShow" style="border-right: solid 1rpx #D9D9D9;">
				添加时间
				<image src="../../static/icon3.png"></image>
				<view class="tab-option" v-if="show">
					<view>充值</view>
					<view>项目退款</view>
				</view>
			</view>
			<view class="flex align tab-item" style="border-right: solid 1rpx #D9D9D9;">
				状态
				<image src="../../static/icon3.png"></image>
			</view>
		</view> -->
		<view class="list" v-for="(item,index) in list" :key="index">
			<view class="list-info flex between">
				<view class="list-info-left">
					<image src="../../static/head.png" v-if="item.head==null||item.head==''"></image>
					<image :src="item.head" v-else></image>
					<view>{{item.status==0?'关闭':'正常'}}</view>
				</view>
				<view class="list-info2">
					<view class="name">云媒科技</view>
					<view>ID:{{item.id}}</view>
					<view>昵称：{{item.nickname}}</view>
					<view>粉丝：{{item.fensi_count}}</view>
					<view>视频数：{{item.video_count}}</view>
					<view>意向客户：{{item.intention_count}}</view>
					<view>授权到期：{{item.token_out_time}}</view>
					<view>自动续约：{{item.refresh_out_time}}</view>
				</view>
				<view class="list-info3">
					<view class="zan flex align" style="justify-content: flex-end;">
						<image src="../../static/zan.png" mode="widthFix"></image>
						{{item.digg_count}}
					</view>
				</view>
			</view>
			<!-- <view class="time">2023年12月20日</view>
			<view class="imgList flex align between">
				<view class="img-item">
					<image src="../../static/video/img.png"></image>
					<view>这是你的“守”</view>
				</view>
				<view class="img-item">
					<image src="../../static/video/img.png"></image>
					<view>这是你的“守”</view>
				</view>
			</view> -->
		</view>
		<uni-load-more :status="status" v-if="!empty" :content-text="loadText"></uni-load-more>
		<xw-empty :isShow="empty" text="暂无数据" textColor="#777777"></xw-empty>
	</view>
</template>

<script>
	import {
		qiyeUserIndex,
		rankDel
	} from '@/api/apiData.js';
	export default {
		data() {
			return {
				searchValue: '',
				show: false,
				totalPage: 1,
				page: 0,
				offset: 20,
				list: [],
				scrollTop: 0,
				empty: false,
				loadText: {
					loadmore: '点击或上拉加载更多',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
				status: 'loadmore',
				merge_keyword: '',
			};
		},
		onLoad() {
			this.getlist()
		},
		onPageScroll(e) {
			const that = this;
			that.scrollTop = e.scrollTop;
		},
		onReachBottom() {
			const that = this;
			that.getlist();
		},
		methods: {
			toShow() {
				this.show = !this.show
			},
			change() {
				this.page = 0
				this.list = []
				this.getlist()
			},
			async getlist() {
				const that = this;
				const {
					totalPage,
					page,
					offset,
					list,
					group_id,
					type,
					merge_keyword,
					statusA,
					rank_id
				} = that;
			
				let obj = {
					menu_url: 'qiye_user',
					limit: offset,
					offset: page,
					sort: 'addtime',
					order: 'desc',
					_: new Date().getTime(),
					filter: {},
					op: {}
					// filter:merge_keyword=='',
					// op:encodeURIComponent(JSON.stringify(filter))
				};
				if (merge_keyword != '') {
					obj.filter = JSON.stringify({
						"nickname": merge_keyword.toString()
					})
					obj.op = JSON.stringify({
						"nickname": '='
					})
				}
				that.status = 'loading';
				if (totalPage > page) {
					let result = await qiyeUserIndex(obj);
					that.page = page + 1;
					if (result.total == 0) {
						that.empty = true;
						that.status = 'nomore';
						return;
					}
					that.empty = false;
					setTimeout(() => {
						that.status = 'loadmore';
					}, 500);
					that.list = list.concat(result.rows);
					that.totalPage = Math.ceil(result.total / offset);
				} else {
					setTimeout(() => {
						that.status = 'nomore';
					}, 500);
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		padding: 13rpx 30rpx;
	}

	.tabs {
		background: white;
		padding: 15rpx 0;
		margin: 14rpx 0;

		.tab-item {
			flex: 1;
			text-align: center;
			justify-content: center;
			position: relative;

			image {
				width: 22rpx;
				height: 12rpx;
				margin-left: 26rpx;
			}

			.tab-option {
				position: absolute;
				width: 100%;
				top: 60rpx;
				background: white;
				box-shadow: 1rpx 1rpx 1rpx 2rpx gainsboro;

				view {
					padding: 16rpx 0;
					border-bottom: solid 1rpx #D9D9D9;
				}
			}
		}
	}

	.option {
		display: grid;
		grid-template-columns: 1fr 1fr 1fr 1fr;
		grid-row-gap: 14rpx;
		grid-column-gap: 20rpx;
		.option-item{
			background: #2D2D2D;
			color: white;
			line-height: 48rpx;
			text-align: center;
			font-size: 20rpx;
			border-radius: 8rpx;
		}
	}
	.list{
		background: white;
		padding: 37rpx 19rpx;
		margin-top: 14rpx;
		border-radius: 10rpx;
		.list-info{
			.list-info-left{
				image{
					width: 143.57rpx;
					height: 143.57rpx;
				}
				view{
					width: 86rpx;
					line-height: 31rpx;
					color: white;
					background: #369805;
					border-radius: 20rpx;
					margin: 8rpx auto;
					text-align: center;
					font-size: 20rpx;
				}
			}
			.list-info2{
				font-size: 18rpx;
				color: #424242;
				width: 54%;
				.name{
					font-size: 32rpx;
					font-weight: bold;
					color: #0F0F0F;
				}
				view{
					margin-bottom: 5rpx;
				}
			}
			.list-info3{
				font-size: 18rpx;
				color: #424242;
				margin-left: 10rpx;
				.zan{
					font-size: 24rpx;
					margin-bottom: 26rpx;
					justify-content: flex-end;
					image{
						width: 29rpx;
						height: 35rpx;
						margin-right: 9rpx;
					}
				}
			}
		}
		.time{
			font-size: 16rpx;
			color: #424242;
			text-align: right;
			border-bottom: solid 1rpx #707070;
		}
		.imgList{
			margin: 16rpx 33rpx;
			.img-item{
				text-align: center;
				font-size: 24rpx;
				image{
					width: 245rpx;
					height: 137rpx;
				}
			}
		}
	}
</style>